package fr.liglab.adele.icasa.house.util;

import fr.liglab.adele.icasa.device.light.BinaryLight;
import fr.liglab.adele.icasa.device.light.DimmerLight;
import fr.liglab.adele.icasa.device.presence.PresenceSensor;
import fr.liglab.adele.icasa.device.presence.Speaker;
import fr.liglab.adele.icasa.device.temperature.Cooler;
import fr.liglab.adele.icasa.device.temperature.Heater;
import fr.liglab.adele.icasa.device.temperature.Thermometer;
import fr.liglab.adele.icasa.house.factory.dao.GenesisDeviceDAO;

public class PrettyPrint {

	public static void printcomponent(GenesisDeviceDAO ge){
		if(ge.getClasstype()==BinaryLight.class){
			BinaryLight comp=(BinaryLight)ge.getObject();			
			System.out.println("Name:"+ge.getCompName()+"\n\tLIGHT:"+comp.getPowerStatus());
		}else if(ge.getClasstype()==Cooler.class){
			Cooler comp=(Cooler)ge.getObject();			
			System.out.println("Name:"+ge.getCompName()+"\n\tCOOLER:"+comp.getPowerLevel());
		}else if(ge.getClasstype()==Heater.class){
			Heater comp=(Heater)ge.getObject();			
			System.out.println("Name:"+ge.getCompName()+"\n\tHEATER:"+comp.getPowerLevel());
		}else if(ge.getClasstype()==Thermometer.class){
			Thermometer comp=(Thermometer)ge.getObject();			
			System.out.println("Name:"+ge.getCompName()+"\n\tTEMPERATURE:"+comp.getTemperature());
		}else if(ge.getClasstype()==PresenceSensor.class){
			PresenceSensor comp=(PresenceSensor)ge.getObject();			
			System.out.println("Name:"+ge.getCompName()+"\n\tSENSOR:"+comp.getSensedPresence());
		}else if(ge.getClasstype()==DimmerLight.class){
			DimmerLight comp=(DimmerLight)ge.getObject();			
			System.out.println("Name:"+ge.getCompName()+"\n\tLIGHT:"+comp.getPowerLevel());
		}else if(ge.getClasstype()==Speaker.class){
			Speaker comp=(Speaker)ge.getObject();
			System.out.println("Name:"+ge.getCompName()+"\n\tSPEAKER:"+comp.isPlaying());
		}
	}
	
}
